import java.util.ArrayList;


public class MovieLister {
	
	private IMovieFinder movieFinder;
	
	public MovieLister(){
		this.movieFinder = new ColonDelimitedMovieFinder();
	}
	
	public Movie[] moviesDirectedBy(String director){
		ArrayList<Movie> allMovies = this.movieFinder.findall();
		ArrayList<Movie> filteredMovies = new ArrayList<Movie>();
		
		for(int i = 0; i < allMovies.size(); i++){
			if(allMovies.get(i).getDirector().equals(director)){
				filteredMovies.add(allMovies.get(i));
			}
		}
		
		return filteredMovies.toArray(new Movie[filteredMovies.size()]);
	}
}
